package com.derbysoft.lowcostadapter.commons.repository.impl;

import com.derbysoft.lowcostadapter.commons.model.ReservationDetail;
import com.derbysoft.lowcostadapter.commons.model.ReservationLog;
import com.derbysoft.lowcostadapter.commons.repository.ReservationDetailRepository;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by: jason
 * Date: 2012-09-27
 */
@Repository("reservationDetailRepository")
public class ReservationDetailRepositoryImpl extends CommonService<ReservationDetail>
        implements ReservationDetailRepository {
    @Override
    public List<ReservationDetail> find(ReservationLog reservationLog) {
        DetachedCriteria detachedCriteria = DetachedCriteria.forClass(ReservationDetail.class);
        detachedCriteria.add(Restrictions.eq("reservationLog", reservationLog));
        return find(detachedCriteria);
    }
}
